package assignmentstrategy

import (
	"codejy/analysis/codeanalysis"
	"codejy/store"
	"codejy/structdef"
)

// 这种情况是在函数内部没有定义此变量，但是在全局变量中有定义
type VariableGlobalStrategy struct {
}

func init() {
	RegisterStrategy(&VariableGlobalStrategy{})
}
func (n VariableGlobalStrategy) getId() int {
	return codeanalysis.VariableGlobal
}

func (n VariableGlobalStrategy) Execute(threadStore *structdef.ThreadStore, code string) string {
	v, _ := store.GetGlobalVariable(threadStore, code)
	return v.Value
}
